﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class index : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string loginName = "";

    }

    protected void ConOpen()
    {
        string connStr = ConfigurationManager.ConnectionStrings["PMMSConnectionString"].ConnectionString;
        SqlConnection conn = new SqlConnection(connStr);
        if (conn.State == ConnectionState.Closed)
        {
            conn.Open();
        }
    }
    protected void ConClose()
    {
        string connStr = ConfigurationManager.ConnectionStrings["PMMSConnectionString"].ConnectionString;
        SqlConnection conn = new SqlConnection(connStr);
        if (conn.State == ConnectionState.Open)
        {
            conn.Close();
        }
    }

    protected void Sign_Up(string userName,string pwd)
    {
        string connStr = ConfigurationManager.ConnectionStrings["PMMSConnectionString"].ConnectionString;
        SqlConnection conn = new SqlConnection(connStr);
        if (conn.State == ConnectionState.Closed)
        {
            conn.Open();
        }
        string time = DateTime.Now.ToString(CultureInfo.InvariantCulture);
        string sign = string.Format("insert into Table_User(UserName,PWD,Type,Time) values('{0}','{1}','{2}','{3}')", userName, pwd, 1, time);
       
        SqlCommand comm = new SqlCommand(sign,conn);
        int executeNonQuery = comm.ExecuteNonQuery();
        conn.Close();
    }

    protected void SignUp_Click(object sender, EventArgs e)
    {
        string username = user.Text.ToString();
        string pwd = password.Text.ToString();
        Sign_Up(username,pwd);
       

    }

   
}